package emulator.shell.GUI;

import java.awt.Color;
import java.io.IOException;
import java.io.OutputStream;

import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;


class ConsoleOutputStream extends OutputStream {

	private ConsoleFrame console = null;
	private SimpleAttributeSet attributes = new SimpleAttributeSet();
	
	public ConsoleOutputStream(ConsoleFrame console, Color textColor, boolean bold ) {
		this.console = console;
	    StyleConstants.setForeground( attributes, textColor );
	    StyleConstants.setFontFamily(attributes, "Monospaced");
	    StyleConstants.setFontSize( attributes, 12 );
	    StyleConstants.setBold( attributes, bold );
	}
	
	public void write( int b ) throws IOException {
		 console.write(String.valueOf( ( char )b ), attributes);
	}

}